
import cloud from '@tbmp/mp-cloud-sdk';
// import qrcode from 'qrcode';
cloud.init({
  env: 'online'
});
App({
  cloud,
  // qrcode,
  globalData:{
    shop_id:''
  },
  onLaunch(options) {
    my.authorize({
      scopes:'*',
      success(res){
        console.log(res)
      }
    })
    this.loadShop();
    
  },
  onShow(options) {
    // 从后台被 scheme 重新打开
    // options.query == {number:1}
  },
   async loadShop() {
     const cloud=this.cloud;
      try {
        const res = await cloud.topApi.invoke({
          api: 'taobao.shop.seller.get',
          authScope: '*',
          data: { fields: 'sid,title,pic_path' }
        });
        this.globalData.shop_id = res.shop.sid;
        console.log(getApp().globalData)
       
      } catch (e) {
        my.alert({ content: 'error ' + e.message })
      }
    },

});
